package Pattern.FactoryPattern.graph;

public class ShapeFactory {
    //使用getShape方法获取形状类型的对象
    public Shape getShape(String shapeType){
        if(shapeType == null){
            return null;
        }
        shapeType = shapeType.toLowerCase();
        switch (shapeType){
            case "circle":
                return new Circle();
            case "rectangle":
                return new Rectangle();
            case "square":
                return new Square();
            default:
                return null;
        }
    }
}
